package com.example.test_1;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;

import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;

import com.example.test_1.databinding.ActivityDemoFindBidBinding;

public class DemoFindBid extends AppCompatActivity {

//    private Button loginBtn;

    //定义变量
    private ActivityDemoFindBidBinding binding;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_demo_find_bid);

        //定义好变量后，初始化变量
        binding = ActivityDemoFindBidBinding.inflate(getLayoutInflater());
        setContentView(binding.getRoot());

        //然后就可以直接使用按钮
        binding.loginBtn2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Toast.makeText(DemoFindBid.this, "电视的打赏", Toast.LENGTH_SHORT).show();
            }
        });
        binding.loginBtn7.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Toast.makeText(DemoFindBid.this, "圣诞节即将", Toast.LENGTH_SHORT).show();
            }
        });


        //ViewBinding
        /**
         1.首先我们要去启用这个ViewBinding,在build.grade当中需要去启用它
         ViewBinding{
         enable true
         }
         2.然后去绑定视图，先去定义一个binding（命名规则：布局名称的驼峰命名＋binding
         */

//        loginBtn = findViewById(R.id.loginBtn);
//        loginBtn.setOnClickListener(new View.OnClickListener() {
//            @Override
//            public void onClick(View view) {
//                Toast.makeText(DemoFindBid.this, "点击事件成功", Toast.LENGTH_SHORT).show();
//            }
//        });
    }
}